/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package interfazAWT;
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Frame;
import java.awt.Graphics;

import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Label;
import java.awt.Menu;
import java.awt.MenuBar;
import java.awt.MenuItem;
import java.awt.Panel;
import java.awt.TextArea;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;


/**
 *
 * @author djdracku
 */
public class Paint extends Canvas {

     Frame f=new Frame("Bienvenido Buscaminas");
    Panel ocul=new Panel();
    TextArea t=new TextArea();
    Panel arri=new Panel();
    Menu me = new Menu("Archivo");
        MenuBar bar = new MenuBar();
        MenuItem mi1 = new MenuItem("Nuevo");
        MenuItem mi5 = new MenuItem("Abrir");
        MenuItem mi4 = new MenuItem("Guardar");
        MenuItem mi2 = new MenuItem("Salir");
        Menu mi = new Menu("Ver");
        MenuItem mi3 = new MenuItem("Ver");





     public void visible() {


        f.setBackground(Color.BLACK);
        ocul.setLayout(new GridLayout(7, 7));
        f.setSize(600, 600);
        f.setResizable(false);

        mi1.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {

              Paint p=new Paint();
              p.visible();
              f.dispose();

            }
        });
        

         mi2.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                System.exit(0);
            }
        });



        f.addWindowListener(new WindowAdapter() {

            @Override
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });


        mi3.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
            Paint2 p=new Paint2();
            p.visible();
            f.dispose();
       

            }
        });

         mi4.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {

             Ventana v=new Ventana();
             v.visible();
             f.dispose();

            }
        });
         mi5.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {

             AbrirAchivo a=new AbrirAchivo();
             a.visible();
             f.dispose();

            }
        });



        Panel p21=new Panel();
        p21.setLayout(new GridLayout(2, 1));
        Button b29 = new Button(" "){
        public void paint(Graphics g){
                Image img =null;
                try{
                    img=javax.imageio.ImageIO.read(new File("imagenes/pincell.jpg"));
                }catch(IOException e){
                e.printStackTrace();
            }
                g.drawImage(img, 2, 1,this);
            }


            };

        
       
        Label l=new Label("Pincel");
        p21.setBackground(Color.WHITE);

        p21.add(b29,BorderLayout.CENTER);
        p21.add(l);


  Panel p19=new Panel();
p19.setLayout(new GridLayout(1,1));

Panel p20=new Panel();

p19.add(p20);

p20.setLayout(new GridLayout(2,3));
      Button b19 = new Button(""){
       public void paint(Graphics g){
                Image img =null;
                try{
                    img=javax.imageio.ImageIO.read(new File("imagenes/Lapiz.jpg"));
                }catch(IOException e){
                e.printStackTrace();
            }
                g.drawImage(img, 2, 1,this);
            }


            };

         
              Button b24 = new Button(""){
                   public void paint(Graphics g){
                Image img =null;
                try{
                    img=javax.imageio.ImageIO.read(new File("imagenes/Pintura.jpg"));
                }catch(IOException e){
                e.printStackTrace();
            }
                g.drawImage(img, 2, 1,this);
            }


            };

               Button b25 = new Button(""){
                    public void paint(Graphics g){
                Image img =null;
                try{
                    img=javax.imageio.ImageIO.read(new File("imagenes/A.jpg"));
                }catch(IOException e){
                e.printStackTrace();
            }
                g.drawImage(img, 2, 1,this);
            }


            };


        
              Button b26 = new Button(""){
                   public void paint(Graphics g){
                Image img =null;
                try{
                    img=javax.imageio.ImageIO.read(new File("imagenes/Borrador.jpg"));
                }catch(IOException e){
                e.printStackTrace();
            }
                g.drawImage(img, 2, 1,this);
            }


            };
               Button b27 = new Button(""){
                public void paint(Graphics g){
                Image img =null;
                try{
                    img=javax.imageio.ImageIO.read(new File("imagenes/Gotero.jpg"));
                }catch(IOException e){
                e.printStackTrace();
            }
                g.drawImage(img, 2, 1,this);
            }


            };

          
              Button b28 = new Button(""){
               public void paint(Graphics g){
                Image img =null;
                try{
                    img=javax.imageio.ImageIO.read(new File("imagenes/lupa.jpg"));
                }catch(IOException e){
                e.printStackTrace();
            }
                g.drawImage(img, 2, 1,this);
            }


            };

      p20.add(b19);
      p20.add(b24);
      p20.add(b25);
      p20.add(b26);
      p20.add(b27);
      p20.add(b28);





        Panel p12=new Panel();
p12.setLayout(new GridLayout(1,1));
Panel p121=new Panel();

p12.add(p121);

p121.setLayout(new GridLayout(3,4));
      Button b11 = new Button(""){
       public void paint(Graphics g){
                Image img =null;
                try{
                    img=javax.imageio.ImageIO.read(new File("imagenes/Circulo.PNG"));
                }catch(IOException e){
                e.printStackTrace();
            }
                g.drawImage(img, 2, 1,this);
            }


            };

       Button b12 = new Button(""){
        public void paint(Graphics g){
                Image img =null;
                try{
                    img=javax.imageio.ImageIO.read(new File("imagenes/Estrella.PNG"));
                }catch(IOException e){
                e.printStackTrace();
            }
                g.drawImage(img, 2, 1,this);
            }


            };

                 Button b13 = new Button(""){
                      public void paint(Graphics g){
                Image img =null;
                try{
                    img=javax.imageio.ImageIO.read(new File("imagenes/EstrellaCom.PNG"));
                }catch(IOException e){
                e.printStackTrace();
            }
                g.drawImage(img, 2, 1,this);
            }


            };


                    Button b14 = new Button("  "){
                         public void paint(Graphics g){
                Image img =null;
                try{
                    img=javax.imageio.ImageIO.read(new File("imagenes/Flecha.PNG"));
                }catch(IOException e){
                e.printStackTrace();
            }
                g.drawImage(img, 2, 1,this);
            }


            };

                    
                     Button b15 = new Button(""){
                        public void paint(Graphics g){
                Image img =null;
                try{
                    img=javax.imageio.ImageIO.read(new File("imagenes/linea.PNG"));
                }catch(IOException e){
                e.printStackTrace();
            }
                g.drawImage(img, 2, 1,this);
            }


            };
         
              Button b16 = new Button(""){
                 public void paint(Graphics g){
                Image img =null;
                try{
                    img=javax.imageio.ImageIO.read(new File("imagenes/LineaCurvas.PNG"));
                }catch(IOException e){
                e.printStackTrace();
            }
                g.drawImage(img, 2, 1,this);
            }


            };
                 Button b17 = new Button(""){
                        public void paint(Graphics g){
                Image img =null;
                try{
                    img=javax.imageio.ImageIO.read(new File("imagenes/Rectangulo.PNG"));
                }catch(IOException e){
                e.printStackTrace();
            }
                g.drawImage(img, 2, 1,this);
            }


            };

                    Button b18 = new Button("RESET"){
                           public void paint(Graphics g){
                Image img =null;
                try{
                    img=javax.imageio.ImageIO.read(new File("imagenes/Rombo.PNG"));
                }catch(IOException e){
                e.printStackTrace();
            }
                g.drawImage(img, 2, 1,this);
            }


            };

                     Button b23 = new Button("RESET"){
                        public void paint(Graphics g){
                Image img =null;
                try{
                    img=javax.imageio.ImageIO.read(new File("imagenes/Triangulo.PNG"));
                }catch(IOException e){
                e.printStackTrace();
            }
                g.drawImage(img, 2, 1,this);
            }


            };

      p121.add(b11);
      p121.add(b12);
      p121.add(b13);
      p121.add(b14);
      p121.add(b15);
      p121.add(b16);
      p121.add(b17);
      p121.add(b18);
      p121.add(b23);



//Panel pp121=new Panel();
//Panel pp122=new Panel();
Panel pp123=new Panel();
//p121.add(pp121);
//p121.add(pp122);
//pp121.setLayout(new BorderLayout());
//pp122.setLayout(new BorderLayout());
//pp121.add(pp123);
pp123.setLayout(new GridLayout(3,5));
Button  b1 = new Button();
b1.setBackground(new Color(0,0,0));//negro
pp123.add(b1);
Button  b2 = new Button();
b2.setBackground(new Color(159,80,0));//cafe
pp123.add(b2);
Button  b3 = new Button();
b3.setBackground(new Color(255,62,158));//rosa
pp123.add(b3);
Button  b4 = new Button();
b4.setBackground(new Color(255,136,17));//naranja
pp123.add(b4);
Button  b5 = new Button();
b5.setBackground(new Color(255,255,54));//amarillo
pp123.add(b5);
Button  b6 = new Button();
b6.setBackground(new Color(145,34,255));//morado
pp123.add(b6);
Button  b7 = new Button();
b7.setBackground(new Color(230,0,0));//rojo
pp123.add(b7);
Button  b8 = new Button();
b8.setBackground(new Color(70,70,70));//gris oscuro
pp123.add(b8);
Button  b9 = new Button();
b9.setBackground(new Color(117,234,0));//verde
pp123.add(b9);
Button  b10 = new Button();
b10.setBackground(new Color(20,130,171));//azul fuerte
pp123.add(b10);
Button  b21 = new Button();
b21.setBackground(new Color(117,234,0));//verde
pp123.add(b21);
Button  b22 = new Button();
b22.setBackground(new Color(20,130,171));//azul fuerte
pp123.add(b22);

  
       
        arri.add(p19);
        arri.add(p21);
        arri.add(p12);
        arri.add(pp123,BorderLayout.WEST);
        arri.setLayout(new GridLayout());

        //f.add(arri);

                f.add(BorderLayout.NORTH, arri);
        f.add(BorderLayout.CENTER, t);

        me.add(mi1);
        me.add(mi5);
        me.add(mi4);



        me.add(mi2);
        mi.add(mi3);
        bar.add(me);
        bar.add(mi);
        f.setMenuBar(bar);

        f.setLocation(200, 100);
        f.setVisible(true);


    }
     



   public static void main(String args[]){



   Paint p=new Paint();
   p.visible();

    }


}
